package com.aaa.web.controller.secondcar;

import com.aaa.entity.secondcar.SecondCarDetailMessage;
import com.aaa.entity.secondcar.SecondCarTransferMessage;
import com.aaa.web.commons.Result;
import com.aaa.web.commons.SecondCarVerifyQuery;
import com.aaa.web.service.secondcarservice.SecondCarTransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
* @program:
* @description: 二手车过户界面
* @author: 许一鑫
* @create: 9:23 2019/1/3
**/
@Controller
@RequestMapping("/SecondCarTransferContreller")
public class SecondCarTransferContreller {
    /**自动注入*/
    @Autowired
    private SecondCarTransferService service;
    /**跳转二手车过户界面*/
    @RequestMapping("/GetSecondCarTransferPage")
    public String getSecondCarTransferPage(Model model){
        List permissionList = null;
        model.addAttribute("list",permissionList);
        return "views/webhtml/secondcar/secondcartransfer";
    }
    /**查询所有二手车相关信息展现在过户信息栏分页及搜索*/
    @RequestMapping("/GetcartransferRelatedMessage")
    @ResponseBody
    public Map getCarTransferRelatedMessage(SecondCarVerifyQuery query){
        Map map=service.getCarTransferRelatedMessage(query);
        return map;
    }
    /**根据车主电话和车出厂码查询出需要过户的二手车信息*/
    @RequestMapping("/GetcartransferDetailMessage")
    @ResponseBody
    public List<SecondCarDetailMessage> getCarTransferDetailMessage(SecondCarDetailMessage s){
        List<SecondCarDetailMessage> list=service.getCarTransferDetailMessage(s);
        return list;
    }
    /**根据原车主电话号码和新车主电话号码进行二手车过户*/
    @RequestMapping("/TransferCar")
    @ResponseBody
    public Result transferCar(SecondCarTransferMessage s){

        return service.transferCar(s);
    }
}
